home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / asmsrc / tango2.lha / SOURCES / RAY.S < prev    next >
Encoding:
Text File  |  1988-07-19  |  9.1 KB  |  460 lines

  1. ; ****************************************
  2. ; ** INTRO NUMBER 5 (C) 1990 CRYPTIC UK **
  3. ; ** CODED BY: TANGO                    **
  4. ; ** MUSIC BY: COUNT                    **
  5. ; ****************************************
  6.  
  7.     opt c-
  8.     section blitter,code_c            Chip Ram please !!
  9.     include    df1:definitions            Give me some hardware reggies
  10.     include    df1:macros                Give me some macros
  11.     
  12.         
  13. ;LOCAL CONSTANTS
  14.  
  15. icra        equ $bfed01                
  16. allocmem     =-30-168                
  17. freemem     =-30-180                
  18. fontmemory    =4000
  19.  
  20.  
  21. TAKEOVER:
  22.         
  23.     LEA custom,a5        
  24.     LEA GFXLIB(PC),a1             Point to 'graphics.library'
  25.     MOVEQ #0,D0                     Doesn't matter which version
  26.      MOVE.L 4.w,a6                 EXECBASE
  27.     jsr    -132(a6)                 task switching off (forbid)
  28.      JSR -$228(a6)                  Openlibrary
  29.      MOVE.L D0,GFXBASE             Store library address
  30.  
  31.         
  32. ;Now put the graphic addresses in the CopperList         
  33.  
  34.      move.l    screenx,d1            Bitplane memory address
  35.     move.w    d1,bp1lo+2            for scroll 1.
  36.      swap    d1
  37.      move.w    d1,bp1hi+2
  38.  
  39.      move.l    screeny,d1            Bitplane memory address
  40.     move.w    d1,abp1lo+2            for scroll 2.
  41.      swap    d1
  42.      move.w    d1,abp1hi+2
  43.  
  44.     
  45.      move.l GFXBASE,d0            Move gfxbase offset to d0
  46.      MOVE.L D0,A6                
  47.      MOVE.W #$80,dmacon(a5)        Turn off copper whilst changing it
  48.      MOVE.L $32(A6),WBCOPPER         Store old (WBench) copper address
  49.      MOVE.L #OURCOPPER,$32(A6)    Point to new copper list (our own)
  50.      MOVE.W #$8080,dmacon(a5)    Re-enable copper
  51.      MOVE.W #$8010,intena(a5)        
  52.      MOVE.L $6c,old                Save work bench interrupt
  53.      MOVE.L #LEV3,$6c            Point to were to set up interrupt
  54.     move.w    intenar(a5),systemints
  55.     move.b    #%01111111,icra        Kill keyboard.
  56.         
  57. WAIT:     
  58.     BTST #6,$BFE001                This waits for the left
  59.      BNE.S    WAIT                mouse button to be pressed
  60.     move.l    4.w,a6                EXECBASE
  61.      MOVE.L old,$6c                Restore system interrupts
  62.     MOVE.L GFXBASE,A6
  63.      MOVE.W #$80,dmacon(a5)        Disable DMA
  64.      MOVE.L WBCOPPER,$32(A6)        Restore old copperlist
  65.      MOVE.W #$8080,dmacon(a5)    Enable DMA
  66.      move.w    systemints,d0        Systems interrupt
  67.      or.w    #$c000,d0
  68.      move.w    d0,intena(a5)        Enable OS interrupts
  69.      move.b    #%10011011,icra        Enable keyboard
  70.     clr.w    $dff0a8                Clear music
  71.     clr.w    $dff0b8
  72.     clr.w    $dff0c8
  73.     clr.w    $dff0d8
  74.     move.w    #$f,$dff096
  75.     rts
  76.  
  77.  
  78. ERROR:    
  79.     move.l 4.w,a6                Get EXECBASE
  80.     jsr    -138(a6)                Permit ( multi-tasking on )
  81.     moveq    #0,d0                Clear d0
  82.      RTS                            Return to AmigaDOS
  83.  
  84.  
  85. ;This is the NEW level 3 interrupt
  86.  
  87. LEV3:
  88.      Save_all                    Save all registers to the stack
  89.     lea    custom,a5
  90.     AND #$10,intreqr(a5)           Check if interrupt is from Copper 
  91.     BNE out
  92.     move.w    #$8010,$9c            Cause Copper interrupt                                
  93.  
  94. ; ** Main Routines called every VBI **
  95.     
  96.     bsr    testscroll
  97.     bsr    testscroll2
  98.     bsr    bounce2
  99.     bsr    bounce
  100.         
  101. out:     
  102.     Return_all
  103.     DC.W $4ef9                    hex value for  JMP instruction
  104. old:     
  105.     DC.L 0                        will jump to normal interrupt
  106.  
  107.  
  108. ; ** THE SCROLL ROUTINE **
  109.  
  110. testscroll:
  111.     tst.l    stopper
  112.     beq.s    scroll
  113.     sub.l    #1,stopper
  114.     rts
  115. scroll:
  116.     cmp.l    #15,val                    Blitshifted all <<<
  117.     blo.s    coarse_scroll_it        No then get doing it !!
  118.     bsr        blit_char                Blit letter to screen
  119.     clr.l    val                        Reset index
  120. coarse_scroll_it:
  121.     bsr        coarse                    Scroll all line
  122.     rts                            
  123.  
  124. testscroll2:
  125.     tst.l    stopper2                Test for pause.
  126.     beq.s    scroll2
  127.     sub.l    #1,stopper2
  128.     rts
  129. scroll2:
  130.     cmp.l    #15,val2                Blitshifted all <<<
  131.     blo.s    coarse_scroll_it2        No then get doing it blitter man !!
  132.     bsr        blit_char2                Blit letter to screen
  133.     clr.l    val2                    Reset index
  134. coarse_scroll_it2:
  135.     bsr        coarse2                    Scroll all line
  136.     rts                            
  137.  
  138.     
  139. ; ** BLIT LETTER ON THE SCREEN **
  140.  
  141. blit_char
  142.     jsr        text
  143.     lea        custom,a5                Get custom chip address
  144.     move.l    screenx,a0                 The screen on which scrolly is.
  145.     move.l    #font,a1                 Put font in blitter source
  146.     add.l    d1,a1
  147. blit_test:
  148.     btst    #14,$dff002                 Blitter busy !!!
  149.     bne    blit_test                     Lets wait till she finishes !
  150.     move.w    #$ffff,bltafwm(a5)        Mask 
  151.     move.w    #$ffff,bltalwm(a5)        Mask 
  152.     move.l    a0,bltdpth(a5)             Blitter dest D (BOTTOM OF SCREEN)
  153.     move.l    a1,bltapth(a5)             Blitter source A (SCROLLING FONT)
  154.     move.w    #38,bltamod(a5)             Modulo (20-1)*2
  155.     move.w    #38,bltdmod(a5)             Modulo (20-1)*2
  156.     move.w    #$9f0,bltcon0(a5)         Minterms D=A
  157.     clr.w    bltcon1(a5)                 Set Ascending mode
  158.      move.w    #16*64+1,bltsize(a5)     Blit size (SIZE OF FONT)
  159.     rts                                  Return
  160.  
  161.  
  162. ; ** BLITSHIFT THE ENTIRE SCROLL LINE **
  163. ;
  164. ;     FUNCTION: TO BARREL SHIFT THE ENTIRE SCROLLING MESSAGE.
  165.  
  166. coarse:
  167.     lea        custom,a5                 
  168.     move.l    screenx,a0                
  169.     move.l    a0,a1
  170.     add.l    #2,a1
  171. blit_wait:
  172.     btst    #14,$dff002            
  173.     bne        blit_wait
  174.     incl    #4,val                    
  175.     move    speed,d7                
  176.     ror        #4,d7                    ; Set to correct bits (12-15)
  177.     or        #%100111110000,d7        ; MINTERM D=A ($9F0)
  178.     move.l    #-1,bltafwm(a5)
  179.     move.l    a1,bltapth(a5)
  180.     move.l    a0,bltdpth(a5)
  181.     move.w    #0,bltamod(a5)
  182.     move.w    #0,bltdmod(a5)
  183.     move.w    d7,bltcon0(a5)    
  184.     move.w    #20*64+20,bltsize(a5)
  185.     rts    
  186.  
  187. speed:    dc.w    12
  188.  
  189.  
  190. ; ** SCROLL NUMBER TWO **
  191. ;
  192. ; DOCUMENTED IN SCROLL NUMBER ONE.
  193.  
  194. blit_char2:
  195.     jsr        text2
  196.     lea        custom,a5                
  197.     move.l    screeny,a0                 
  198.     move.l    #font,a1                 
  199.     add.l    d1,a1
  200. blit_test2:
  201.     btst    #14,$dff002                 
  202.     bne    blit_test2                     
  203.     move.w    #$ffff,bltafwm(a5)        
  204.     move.w    #$ffff,bltalwm(a5)        
  205.     move.l    a0,bltdpth(a5)             
  206.     move.l    a1,bltapth(a5)             
  207.     move.w    #38,bltamod(a5)             
  208.     move.w    #38,bltdmod(a5)             
  209.     move.w    #$9f0,bltcon0(a5)         
  210.     clr.w    bltcon1(a5)                 
  211.      move.w    #16*64+1,bltsize(a5)     
  212.     rts                                  
  213.  
  214. coarse2:
  215.     lea        custom,a5                 
  216.     move.l    screeny,a0                
  217.     move.l    a0,a1
  218.     add.l    #2,a1
  219. blit_wait2:
  220.     btst    #14,$dff002            
  221.     bne        blit_wait2
  222.     incl    #4,val2                    
  223.     move    speed2,d7                
  224.     ror        #4,d7                    
  225.     or        #%100111110000,d7        
  226.     move.l    #-1,bltafwm(a5)
  227.     move.l    a1,bltapth(a5)
  228.     move.l    a0,bltdpth(a5)
  229.     move.w    #0,bltamod(a5)
  230.     move.w    #0,bltdmod(a5)
  231.     move.w    d7,bltcon0(a5)    
  232.     move.w    #20*64+20,bltsize(a5)
  233.     rts
  234.     
  235. speed2:    dc.w    12
  236.  
  237.  
  238. ; ** THIS CRAPPY CODE BOUNCES THE SCROLLY MESSAGE NUMBER TWO **
  239. ;
  240. ;     ENTRYS  : YCORD-HOW FAR UP AND DOWN SCREEN TO GO.
  241. ;             : DELTAY-WAIT COMMAND IN COPPERLIST.
  242. ;     FUNCTION: BOUNCE THE SCROLLY MESSAGE.
  243.  
  244. bounce:
  245.     cmp.l    #63,ycord
  246.     beq.s    up
  247.     add.l    #1,ycord
  248.     sub.b    #1,deltay
  249.     rts
  250. up: cmp.l    #63,ycordminus
  251.     beq.s    rst_cord
  252.     add.l    #1,ycordminus
  253.     add.b    #1,deltay
  254.     rts
  255. rst_cord:
  256.     clr.l    ycord
  257.     clr.l    ycordminus
  258.     rts
  259.     
  260. ycord:        dc.l    0
  261. ycordminus:    dc.l    0
  262.     even
  263.  
  264.  
  265. ; ** THIS CRAPPY CODE BOUNCES SCROLLY MESSAGE NUMBER ONE (ONE AT THE TOP) **
  266. ;
  267. ;     ENTRYS  : YCORD2-HOW FAR UP AND DOWN SCREEN TO GO.
  268. ;             : DELTAY2-WAIT COMMAND IN COPPERLIST.
  269. ;     FUNCTION: BOUNCE THE SCROLLY MESSAGE.
  270.  
  271. bounce2:
  272.     cmp.l    #63,ycord2
  273.     beq.s    up2
  274.     add.l    #1,ycord2
  275.     add.b    #1,deltay2
  276.     rts
  277. up2:cmp.l    #63,ycordminus2
  278.     beq.s    rst_cord2
  279.     add.l    #1,ycordminus2
  280.     sub.b    #1,deltay2
  281.     rts
  282. rst_cord2:
  283.     clr.l    ycord2
  284.     clr.l    ycordminus2
  285.     rts
  286.     
  287. ycord2:        dc.l    0
  288. ycordminus2:dc.l    0
  289.     even
  290.  
  291.  
  292. ; ** CHARACTER DECODER ROUTINE **
  293.  
  294. text:
  295.     move.l    acurent,a2                Get message
  296.     clr.l    d1                        
  297.     move.b    (a2)+,d1                Update it
  298.     move.b    d1,letter                Store in offset
  299.     cmp.b    #255,d1                    Check for end of message
  300.     beq.w    rst_text                If equal, then reset
  301.     cmp.b    #254,d1
  302.     beq        stop
  303.     sub.l    #32,d1                    Subract 32 (ie space)
  304.     asl        d1                        Times by 2 
  305.     move.l    a2,acurent                Update acurent
  306.     CMP.B    #"4",letter                Is letter "K" or larger
  307.     BPL.s    add_more                If larger then add on
  308.     rts                                Return
  309. add_more:
  310.     CMP.B    #"H",letter                Is letter "U" or larger
  311.     BPL.S    add_more2                If larger then add on
  312.     add.l    #40*15,d1                Get next line down (KLMNOPQRST)
  313.     rts
  314. add_more2:                    
  315.     add.l    #40*30,d1                Get next line down (UVWXYZ0123)
  316.     rts
  317. rst_text:
  318.     move.l    #0,d1
  319.     move.l    #message,d2                Get begining of text
  320.     move.l    d2,acurent                Reset to begining
  321.     rts                                Return
  322. stop:
  323.     move.l    #0,d1
  324.     add.l    #1,acurent
  325.     move.l    #150,stopper
  326.     rts
  327.  
  328. ; ** CHARACTER DECODER ROUTINE NUMBER TWO ! **
  329.  
  330. text2:
  331.     move.l    acurent2,a2                
  332.     clr.l    d1                        
  333.     move.b    (a2)+,d1                
  334.     move.b    d1,letter2                
  335.     cmp.b    #255,d1                    
  336.     beq.w    rst_text2                
  337.     cmp.b    #254,d1
  338.     beq        stop2
  339.     sub.l    #32,d1                    
  340.     asl        d1                        
  341.     move.l    a2,acurent2                
  342.     CMP.B    #"4",letter2            
  343.     BPL.s    add_more20                
  344.     rts                                
  345. add_more20:
  346.     CMP.B    #"H",letter2            
  347.     BPL.S    add_more30                
  348.     add.l    #40*15,d1                
  349.     rts
  350. add_more30:                    
  351.     add.l    #40*30,d1                
  352.     rts
  353. rst_text2:
  354.     move.l    #0,d1
  355.     move.l    #message2,d2            
  356.     move.l    d2,acurent2                
  357.     rts                                
  358. stop2:
  359.     move.l    #0,d1
  360.     add.l    #1,acurent2
  361.     move.l    #150,stopper2
  362.     rts
  363.  
  364.  
  365. ; ** THE FIRST MESSAGE **
  366.  
  367. message:
  368. ; 254=STOP,255=END.
  369.     DC.B    " INTRO CODED BY TANGO     "
  370.     DC.B    "    CRYPTIC UK     ",254
  371.     DC.B    255
  372.     EVEN
  373.  
  374.  
  375. ; ** THE SECOND MESSAGE **
  376.  
  377. message2:
  378. ; 254=STOP,255=END.
  379.     DC.B    " INTRO CODED BY TANGO     "
  380.     DC.B    "    CRYPTIC UK     ",254
  381.     DC.B    "  THIS IS SCROLLER 2 AND ITS BLITSHIFTED"
  382.     DC.B    " IT ALSO HAS THE ABILITY TO.....   "
  383.     DC.B    "       STOP !      ",254   
  384.     DC.B    255
  385.     EVEN
  386.             
  387.  
  388. ; ** THE COPPERLIST **
  389.  
  390. OURCOPPER:
  391.         dc.w    $120,0
  392.         dc.w    $122,0
  393.         dc.w    bpl1mod,0,bpl2mod,0
  394.         dc.w    diwstrt,$2c81+16,diwstop,$2cc1
  395.         dc.w    bplcon0,$1200,bplcon1,$0000
  396.         dc.w    ddfstrt,$38,ddfstop,$d0
  397.         dc.w    color00,$000,color01,$000
  398. deltay2:wait    $3009,$fffe
  399.         dc.w    color01,$f44
  400. bp1lo:    dc.w    bpl1ptl,$0000
  401. bp1hi:    dc.w    bpl1pth,$0000
  402. deltay:    wait    $c009,$fffe
  403. abp1lo:    dc.w    bpl1ptl,$0000
  404. abp1hi:    dc.w    bpl1pth,$0000
  405.         end_copper
  406.         
  407.  
  408. ;LOCAL CONSTANTS
  409.  
  410. WBCOPPER:        DC.L    0
  411. GFXLIB:            DC.B     "graphics.library",0
  412. GFXBASE:        DC.L    0
  413. systemints:        dc.l    0
  414. scroll_offset:    dc.l    0
  415. screenx:        dc.l    picture
  416. screeny:        dc.l    picture2
  417. letter:            dc.b    0
  418. letter2:        dc.b    0
  419. acurent:        dc.l    message
  420. acurent2:        dc.l    message2
  421. val:            dc.l    0
  422. val2:            dc.l    0
  423. stopper:        dc.l    0
  424. stopper2:        dc.l    0
  425.  
  426.  
  427. ;BINARY FILES TO BE INCLUDED
  428.     EVEN
  429. picture    
  430.     dcb.b    6000,0
  431. picture2:
  432.     dcb.b    7000,0
  433. font
  434.     incbin    df1:neatfont.bin
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.     
  442.     
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.     
  451.     
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.